home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok56
/
m2maker
/
txt
/
project.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
6KB
|
183 lines
(*---------------------------------------------------------------------------
:Program. m2Maker
:Author. Thomas Stolze
:Address. Goslarsche Str. 32, 3000 Hannover 21, Germany
:Phone. (0)511 / 75 10 77
:Version. V2.0
:Date. 14-Nov-90
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga V3.32d
:Contents. Programming Utility.
:Remark. Supports the M2Amiga System (C) by A+L AG Switzerland
---------------------------------------------------------------------------*)
IMPLEMENTATION MODULE Project;
FROM Arts IMPORT BreakPoint;
FROM DosD IMPORT FileLockPtr,FileInfoBlockPtr,FileInfoBlock,
accessRead,Date;
FROM DosL IMPORT CreateDir,UnLock,Examine,Rename,ExNext,CurrentDir,
Lock,DateStamp;
FROM FileRequester IMPORT Pattern;
FROM Storage IMPORT Available,ALLOCATE,DEALLOCATE;
FROM InitIntuition IMPORT prgPtr,PrintStatus;
FROM IntuitionD IMPORT GadgetFlags,GadgetFlagSet;
FROM IntuitionL IMPORT RefreshGList;
FROM LSOptions IMPORT SaveOptions;
FROM RequesterWindow IMPORT DeleteProjectRequester,LoadProjectRequester,
TouchRequester;
FROM Routines IMPORT ExecuteStr,FilterLastDir,GetDosErr,MakeExecuteStr,
MakePath,TestForFile,TestForProject;
FROM String IMPORT Concat,Copy,FirstPos,Length;
FROM SYSTEM IMPORT ADR,CAST;
FROM XCopy IMPORT XCopy,XType,SetOneDate;
(*FROM InOut IMPORT WriteLn,WriteString;*)
PROCEDURE SaveProject(txtDir : BOOLEAN);
VAR src,
dest,
test : ARRAY [0..255] OF CHAR;
dir : ARRAY [0.. 40] OF CHAR;
ok : BOOLEAN;
BEGIN
src:=("");
MakePath(prgPtr^.BufferString[3],"m2Maker.cfg",src); SaveOptions(src);
PrintStatus("Save Project !"); ok:=FALSE;
src:=(""); MakePath(prgPtr^.BufferString[3],"",src);
dest:=(""); MakePath(prgPtr^.BufferString[2],"",dest);
IF txtDir THEN ok:=XCopy(src,dest,txt) ELSE ok:=XCopy(src,dest,all) END;
IF NOT ok THEN GetDosErr; END;
src:=(""); MakePath(prgPtr^.BufferString[3],"",src);
src[Length(src)-1]:=00C; Concat(src,".info");
FilterLastDir(prgPtr^.BufferString[3],dir);
MakePath(prgPtr^.BufferString[2],dir,test); test[Length(test)-1]:=00C;
Concat(test,".info");
IF NOT TestForFile(ADR(test)) THEN
ok:= XCopy(src,dest,single);
END;
END SaveProject;
PROCEDURE LoadProject;
VAR src : ARRAY [0..255] OF CHAR;
str,
dir : ARRAY [0.. 31] OF CHAR;
exit : BOOLEAN;
BEGIN
PrintStatus("Load Project !"); exit:=FALSE;
MakePath(prgPtr^.BufferString[3],"",str); str[Length(str)-1]:=00C;
REPEAT
IF LoadProjectRequester(str) THEN
IF FirstPos(str,0,":") # -1 THEN
exit:=TRUE; MakePath(str,"",str); str[Length(str)-1]:=00C;
FilterLastDir(str,dir);
src:=(""); MakePath(prgPtr^.BufferString[2],dir,src);
MakePath(str,"",str); str[Length(str)-1]:=00C;
Copy(prgPtr^.BufferString[3],str);
RefreshGList(ADR(prgPtr^.GadgetArray[3]),prgPtr^.window,NIL,1);
str[Length(str)-Length(dir)+1]:=00C;
IF NOT XCopy(src,str,all) THEN GetDosErr END;
src[Length(src)-1]:=00C; Concat(src,".info");
IF TestForFile(ADR(src)) THEN
IF NOT XCopy(src,str,single) THEN GetDosErr END;
END;
END;
ELSE
exit:=TRUE;
END;
UNTIL exit;
END LoadProject;
PROCEDURE DeleteProject;
VAR file,
dummy : ARRAY [0..255] OF CHAR;
BEGIN
PrintStatus("Delete Project !");
IF DeleteProjectRequester(prgPtr^.BufferString[3]) THEN
file:=(""); MakePath(prgPtr^.BufferString[3],"",file);
dummy:=("C:Delete "); Concat(dummy,file);
dummy[Length(dummy)-1]:=00C; Concat(dummy," ALL QUIET");
ExecuteStr(ADR(dummy));
file:=(""); MakePath(prgPtr^.BufferString[3],"",file);
file[Length(file)-1]:=00C; Concat(file,".info");
IF TestForFile(ADR(file)) THEN
dummy:=("C:Delete "); Concat(dummy,file); Concat(dummy," QUIET");
ExecuteStr(ADR(dummy));
END;
END;
END DeleteProject;
PROCEDURE TouchProject;
VAR fileInfoPtr : FileInfoBlockPtr;
oldLock,
lock : FileLockPtr;
date : Date;
file : ARRAY [0..255] OF CHAR;
bool : BOOLEAN;
PROCEDURE CheckFile(): BOOLEAN;
VAR pat : ARRAY [0..10] OF CHAR;
BEGIN
pat := ("#?.mod");
IF Pattern(fileInfoPtr^.fileName,pat) THEN
RETURN TRUE;
ELSE
pat := ("#?.def");
IF Pattern(fileInfoPtr^.fileName,pat) THEN
RETURN TRUE;
END;
END;
RETURN FALSE;
END CheckFile;
BEGIN
IF TouchRequester() THEN
PrintStatus("Touch Project !!");
IF Available(SIZE(FileInfoBlock)) THEN
ALLOCATE(fileInfoPtr,SIZE(FileInfoBlock));
MakePath(prgPtr^.BufferString[3],"",file);
IF (selected IN prgPtr^.GadgetArray[16].flags) THEN
TestForProject(file,"txt/",file);
END;
file[Length(file)-1]:=00C;
lock:=Lock(ADR(file),accessRead);
IF lock # NIL THEN
oldLock:=CurrentDir(lock);
IF Examine(lock,fileInfoPtr) THEN
REPEAT
IF (fileInfoPtr^.dirEntryType < 0) THEN
IF CheckFile() THEN
DateStamp(ADR(date));
bool:=SetOneDate(fileInfoPtr^.fileName,date,LONGINT(lock));
END;
END;
UNTIL (ExNext(lock,fileInfoPtr) = FALSE);
END;
lock:=CurrentDir(oldLock);
IF lock # NIL THEN UnLock(lock) END;
PrintStatus("Touched Project successfully !");
END;
DEALLOCATE(fileInfoPtr,SIZE(FileInfoBlock));
ELSE
PrintStatus("Could'nt finish Job!");
END;
END;
END TouchProject;
BEGIN
END Project.